import instance from '@/utils/request';


// 获取详情页数据
export function getgoodsdetail(data: { id: string }) {
    return instance({
        url: '/goods/detail',
        method: 'get',
        params: data
    })
}

// 获取相关产品数据
export function getgoodsrelated(data: { id: string }) {
    return instance({
        url: '/goods/related',
        method: 'get',
        params: data
    })
}

//定义加入购物车接口
export function addcarapi(data: {
    goodsId: string,
    productId: string,
    number: number
}) {
    return instance({
        url: '/cart/add',
        method: 'post',
        data: data,
        headers: {
            'Content-Type': 'application/json'
        }
    })
}

// 获取当前购物车中的所有的商品的数量
export function getcartgoodsAmount() {
    return instance({
        url: '/cart/goodscount',
        method: 'get',
    })
}
